<!DOCTYPE html>
<!--修改密码页面-->
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>修改密码</title>
    <link rel="stylesheet" href="static/css/layui.css" media="all">
    <!--    <link rel="stylesheet" href="static/css/style.css">-->
    <style>
        body{background-color: white}
        .layui-form-label{
            width: 100px;
        }
        .layui-input-block {
            margin-left: 130px;
            min-height: 36px
        }
    </style>
    <script src="static/js/jquery-2.1.3.min.js"></script>-
</head>

<body class="body">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>修改密码</legend>
</fieldset>
<form class="layui-form layui-from-pane" style="margin-top:20px">
    <div class="layui-form-item">
        <label class="layui-form-label">旧密码：</label>
        <div class="layui-input-block">
            <input type="text" name="oldpass" id="oldpass" required  lay-verify="required" autocomplete="off" class="layui-input" style="width: 90%">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">新密码：</label>
        <div class="layui-input-block">
            <input type="text" name="newpass" id="newpass" required  lay-verify="required"  autocomplete="off" class="layui-input" style="width: 90%">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">确认密码：</label>
        <div class="layui-input-block">
            <input type="text" name="newpass2" id="newpass2" required  lay-verify="required"  autocomplete="off" class="layui-input" style="width: 90%">
        </div>
    </div>

    <div class="layui-form-item" style="margin-top:40px">
        <div class="layui-input-block">
            <button class="layui-btn  layui-btn-submit " lay-submit="" lay-filter="demo1">修改</button>
        </div>
    </div>
</form>
<script src="static/layuiadmin/layui/layui.js" type='text/javascript'></script>
<script>
    layui.use(['form','layer','jquery'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,$=layui.jquery
        //监听提交
        form.on('submit(demo1)', function(data){
            var oldpass = $("#oldpass").val();
            var newpass = $("#newpass").val();
            var newpass2 = $("#newpass2").val();
            $.ajax({
                url:'/getoldpass',
                type:'POST',
                dataType:'json',
                async: false,
                data:{oldpass:oldpass,newpass:newpass,newpass2:newpass2},
                success: function (result) {
                    if (result.code==0){
                        layer.msg(result.msg,{icon:0});
                    }
                    else{
                        layer.msg(result.msg,{icon:2});
                    }
                },
                error:function (e) {
                    layer.msg('系统错误',{icon:2});
                }
            })
            return false;
        });
    });
</script>
</body>
</html>